<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLiveRoomsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('live_rooms', function (Blueprint $table) {
            $table->id()->comment('直播间表');
            $table->integer('room_id')->comment('直播间号')->index();
            $table->integer('anchor_id')->comment('主播ID')->index();
            $table->string('name',32)->comment('直播间名字');
            $table->string('cover_img')->comment('背景图');
            $table->string('phone')->comment('主播的联系电话');
            $table->string('share_img')->nullable()->comment('分享图');
            $table->timestamp('start_at')->nullable()->comment('直播计划开始时间');
            $table->timestamp('end_at')->nullable()->comment('直播计划结束时间');
            $table->string('error_msg')->nullable()->comment('未通过原因');
            $table->string('mark')->nullable()->comment('备注');
            $table->smallInteger('sort')->default(0)->comment('直播间排序');
            $table->string('room_type',30)->default('mobilePhone')->comment('直播间类型 【pushFlow: 推流，mobilePhone：手机直播】');
            $table->string('screen_type',30)->default('verticalScreen')->comment('手机屏幕类型 【horizontalScreen：横屏，verticalScreen：竖屏】');
            $table->string('live_status',30)->default('notStarted')->comment('直播状态 liveBroadcast：直播中，notStarted：未开始，hasEnded:已结束，noBroadcasting:禁播，suspend：暂停，abnormal：异常，expired：已过期');
            $table->string('status')->default('notApproved')->comment('审核状态 notApproved=未审核 wechatAudit=微信审核 approved=审核通过 auditFailed=审核未通过');
            $table->tinyInteger('is_openLike')->default(0)->comment('是否开启点赞【1:开启 0：关闭】');
            $table->tinyInteger('is_openShelf')->default(0)->comment('是否开启货架 【1:开启 0：关闭】');
            $table->tinyInteger('is_openComments')->default(0)->comment('是否开启评论 【1:开启 0：关闭】');
            $table->tinyInteger('is_show')->default(1)->comment('是否显示【1：显示 0 ：不显示】');
            $table->tinyInteger('replay_status')->default(0)->comment('回放状态 【1:开启 0：关闭】');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('live_rooms');
    }
}
